/**
 * @author jjophin
 */
var apiLoaded;
function loadAPI(api, callback){
    var apiObj = {
        orgchart: {
			packArr: ["orgchart", "table"],
			file: "orgchart.js"
		},
		geomap: {
			packArr: ["geomap"],
			file: "geomap.js"			
		}
    };
	
    var gScript = document.createElement("script");
    gScript.src = "http://www.google.com/jsapi?callback=apiLoaded";
    document.getElementsByTagName("head")[0].appendChild(gScript);
    
	var vgScript = document.createElement("script");
    vgScript.src = apiObj[api].file;
    document.getElementsByTagName("head")[0].appendChild(vgScript);
	
    apiLoaded = function(){
        google.load('visualization', '1', {
            'callback': callback,
            packages: apiObj[api].packArr
        });
    }
}